package com.java.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author: wjr
 * @Description:
 * @Date Created in  2020-09-09 0:50
 * @Modified By:
 */
@WebServlet(value = "/like")
public class LikeServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int likeNum = Integer.parseInt(req.getParameter("likeNum"));
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = resp.getWriter();
        likeNum = likeNum+1;
        System.out.println(likeNum);
        writer.print(likeNum);
    }
}
